from django.db import models

class Location(models.Model):
	name = models.CharField(max_length=50)
	coded_name = models.CharField(max_length=20)
	def __unicode__(self):
			return "%s (%s)" % (self.coded_name, self.name)
			
#class Supplier(models.Model):
#	name = models.CharField(max_length=)

class Item(models.Model):
	name = models.CharField(max_length=50)
	location = models.ForeignKey(Location)
	#CAS should have no spaces, ex: 520-53-6
	cas_num = models.CharField(max_length=20)
	quantity = models.CharField(max_length=15)
	classification = models.CharField(max_length=30,null=True, blank=True)
	supplier = models.CharField(max_length=30)
	mol_formula = models.CharField(max_length=50)
	properties = models.CharField(max_length=100, null=True, blank=True)
	
	class Meta:
		ordering = ["-name"]
	
	def __unicode__(self):
		return "%s (%s)" % (self.name, self.cas_num)
